(ns com.m3958.firstgwt.server.servlet.calendarUtil
  (:import java.util.Calendar )
  (:import java.security.MessageDigest))

(defn get-nowc
  []
  (let [c (Calendar/getInstance)]
    {:year (.get c (Calendar/YEAR))
     :month (inc (.get c (Calendar/MONTH)))}))

(defn md5fy [s]
  (let [alm (MessageDigest/getInstance "MD5")]
  (do
    (.reset alm)
    (.update alm (.getBytes s))
    (reduce (fn [ss item] (str ss (Integer/toHexString (bit-and 0xEF item)))) "" (into [] (.digest alm))))))

